<jsp:useBean id="sessiondata" class="bibbletex.models.SessionData"
	scope="session" />

<%@ page import="bibbletex.models.Collaboration, bibbletex.controllers.CollaborationController" %>
<%@ page import="bibbletex.models.Reference, java.util.UUID" %>

<%
	String page_title;
	String onchangeformjscode="changeAttributes('"+request.getParameter("formprefix")+"',false)";
	String id_parameter = request.getParameter("rid");
	boolean show_title = true;
	String jstitle="collab";
	boolean show_navigation = true;
	String message = null;
	Reference r = null;
	page_title = new String("Edit Reference");
	
	if (id_parameter == null)
		message = new String("No reference ID provided");
	else if (sessiondata.collaboration == null)
		message = new String("The collaboration does not exist");
	else
	{
		if (sessiondata.collaboration_is_editable)
		{
			r = sessiondata.collaboration.getAllReferences().get(
					sessiondata.collaboration.getAllReferences().indexOf(
							new Reference(UUID.fromString(id_parameter))));
			sessiondata.reference = r;
		}
		else
			message = new String("You do NOT have right to do that.");
	}
%>

<script type="text/javascript" src="/js/reference.js"></script>

<% if (message != null) { %>

<h4><%=message %></h4>

<% } else if (r != null) { 
	String rid = id_parameter;
%>

<%@ include file="/collaboration/reference/form.jsp" %>

<% } %>


